package com.jzo2o.customer.controller.agency;

import com.jzo2o.common.utils.UserContext;
import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditAddReqDTO;
import com.jzo2o.customer.model.dto.response.RejectReasonResDTO;
import com.jzo2o.customer.service.IAgencyCertificationAuditService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 机构认证申请相关接口
 */
@RestController("InstitutionCertificationApplicationController")
@RequestMapping("/agency/agency-certification-audit")
public class InstitutionCertificationApplicationController {
    @Resource
    private IAgencyCertificationAuditService agencyCertificationAuditService;

    @PostMapping
    @ApiOperation("机构认证申请审核")
    public void audit(@RequestBody AgencyCertificationAuditAddReqDTO agencyCertificationAuditAddReqDTO) {
        agencyCertificationAuditAddReqDTO.setServeProviderId(UserContext.currentUserId());
        agencyCertificationAuditService.audit(agencyCertificationAuditAddReqDTO);
    }

    @RequestMapping("/rejectReason")
    @ApiOperation("获取机构认证拒绝原因")
    public RejectReasonResDTO getRejectReason() {
        return agencyCertificationAuditService.queryCurrentUserLastRejectReason();
    }


}
